Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for RIPE Atlas Commands #459

Closed
wants to merge 22 commits into from

Conversation

lamaral
Copy link
Contributor

@lamaral lamaral commented Aug 17, 2023

This MR adds initial support for tracerouting via the RIPE Atlas API.
This can aid network troubleshooting in a manner that is visible on Slack for all parties involved.

If the codestyle for this is good, I will further extend the traceroute command to allow for selecting a set of origin probes as well as adding some more commands.

@codecov-commenter
Copy link

codecov-commenter commented Aug 17, 2023

Codecov Report

Merging #459 (ad62786) into master (50f7ec0) will decrease coverage by 0.65%.
The diff coverage is 64.60%.

❗ Current head ad62786 differs from pull request most recent head 0922c93. Consider uploading reports for the commit 0922c93 to get more accurate results

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

@@            Coverage Diff             @@
##           master     #459      +/-   ##
==========================================
- Coverage   82.19%   81.54%   -0.65%     
==========================================
  Files         129      134       +5     
  Lines        5908     6134     +226     
==========================================
+ Hits         4856     5002     +146     
- Misses        929      999      +70     
- Partials      123      133      +10     
Files Changed Coverage Δ
command/ripeatlas/api.go 0.00% <0.00%> (ø)
command/ripeatlas/credits.go 69.38% <69.38%> (ø)
command/ripeatlas/traceroute.go 70.63% <70.63%> (ø)
command/commands.go 100.00% <100.00%> (ø)
command/ripeatlas/commands.go 100.00% <100.00%> (ø)
command/ripeatlas/config.go 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@lamaral
Copy link
Contributor Author

lamaral commented Aug 17, 2023

I guess it needs some tests :D

Copy link
Member

@Woellchen Woellchen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice addition! Please also check the GitHubActions comments

command/ripe_atlas/api.go Outdated Show resolved Hide resolved
command/ripe_atlas/credits.go Outdated Show resolved Hide resolved
command/ripe_atlas/credits.go Outdated Show resolved Hide resolved

var af int
address, err := netip.ParseAddr(destination)
if err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could simplify the if by adding an || address.Is6() here. BTW why are we defaulting to IPv6 when the destination could not be parsed? Is this an implicit "is a hostname" check?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is more of a: if it can't be parsed, it's a hostname and if it's a hostname, use IPv6. The AF defined here is later used for the MeasurementRequest.

I need to actually test what would happen in the case a hostname has IPv4 only.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As an idea we could also launch probes for both families

}
defer response.Body.Close()

if response.StatusCode >= 300 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm 3xx codes are not errors, they are redirects.
Maybe you could try to centralise some of the request making / checking logic because some parts are very similar.

Copy link
Contributor Author

@lamaral lamaral Aug 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it to >= 400.

I will look into making a common function for the API requests.

command/ripe_atlas/traceroute.go Outdated Show resolved Hide resolved
command/ripe_atlas/traceroute.go Outdated Show resolved Hide resolved
command/ripe_atlas/traceroute.go Outdated Show resolved Hide resolved
command/ripe_atlas/credits.go Outdated Show resolved Hide resolved
@brainexe brainexe self-assigned this Sep 11, 2023
@brainexe brainexe added the newcommand Ide/Implememtation for a new command label Sep 11, 2023
@brainexe
Copy link
Member

resolved some conflicts and merged into master

@brainexe brainexe closed this Nov 20, 2023
@brainexe brainexe mentioned this pull request Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
newcommand Ide/Implememtation for a new command
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants